#ifndef BIT_REVERSED_COUNTER_H_INCLUDED
#define BIT_REVERSED_COUNTER_H_INCLUDED

typedef struct bit_reversed_counter
{
	int counter;
	int depth;
}brc;

/**
 * Reverse the bits of v, assuming we have n bits
 * @param v integer to reverse
 * @param n number of bits of v
 * @return the reversed number
 */
int reverseBits(int v, int n);

/**
 * Create and initialize a bit reversal counter
 * @return a new bit reversed counter initialized
 */ 
brc bit_reversed_counter_Init();

/**
 * increment the counter and return the new value in reversed bits
 * @param b a pointer to the bit reversed counter to increment
 * @return the new value in reversed bits
 */
int brc_Increment(brc *b);

/**
 * return the current value of the counter in reversed bits, and decrement the counter
 * if the counter is at 0, return 0 and doesn't decrement it
 * @param b a pointer to the bit reversed counter
 * @return the current value of the counter in reversed bits
 */
int brc_Decrement(brc *b);

/**
 * return the current value of the counter NOT in reversed bits
 * @param b a pointer to the bit reversed counter
 * @return the current value of the counter NOT in reversed bits
 */
int brc_getRealValue(brc *b);




#endif
